//#include "ThreadPool.hpp"
//#include "ThreadPool_v2.hpp"
//#include "ThreadPool_v3.hpp"
#include "ThreadPool_v4.hpp"
#include "Task.hpp"
#include <memory>
#include <time.h>


int main(){
    // unique_ptr<ThreadPool<Task>> tp(new ThreadPool<Task>(N));
    // tp->init();
    // tp->start();
    // tp->check();

    printf("0X%x\n", ThreadPool<Task>::getInstance());
    printf("0X%x\n", ThreadPool<Task>::getInstance());
    printf("0X%x\n", ThreadPool<Task>::getInstance());
    printf("0X%x\n", ThreadPool<Task>::getInstance());
    printf("0X%x\n", ThreadPool<Task>::getInstance());

    string opers = "+-*/%";

    while(true){
        int x = rand() % 20 + 1;
        int y = rand() % 10 + 1;
        char op = opers[rand() % opers.size()];
        Task t(x, y, op);
        //tp->pushTask(t);
        //cout << pthread_self() << " | productor Task: " <<  t.formatArg() << "?" << endl;
        //usleep(50000);

        ThreadPool<Task>::getInstance()->pushTask(t);
    }

}